<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登录</title>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/css/layui.css"/>
    <script src="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/layui.js" type="text/javascript"
            charset="UTF-8"></script>

    <style>
        .window {
            width: 400px;
            position: absolute;
            margin-left: -200px;
            margin-top: -200px;
            top: 50%;
            left: 50%;
            display: block;
            z-index: 2000;
            background: #fff;
            padding: 20px 0;
        }
    </style>
</head>
<body style="background: #f1f1f1;">
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;
    });
</script>
<script>
    layui.use('form', function () {
        var form = layui.form;
    });
</script>

<!-- 头部导航栏 -->
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo"><a style="color: #009688;">龙洞闲置购物系统</a></div>

        <!-- 头部区域（可配合layui已有的水平导航） -->

        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item">
                <a href="ShowALLGoods">首页</a>
            </li>
            <li class="layui-nav-item">
                登录
            </li>
        </ul>

    </div>
</div>
${msg}
<div class="window" id="demo">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
        <legend style="margin-left: 0px;margin-right: 0px;margin: auto;">登录</legend>
    </fieldset>
    <form class="layui-form" action="checkUser" method="post">
        <input type="hidden" name="action" value="login">

        <div class="layui-form-item" style="margin-right: 90px;margin-top: 20px;">
            <label class="layui-form-label">用户名：</label>
            <%--用户名栏--%>
            <div class="layui-input-block">
                <input type="text" name="uname" required lay-verify="required" placeholder="请输入用户名"
                       autocomplete="off" class="layui-input" value="${requestScope.uname}">
            </div>
        </div>
        <div class="layui-form-item" style="margin-right: 90px;margin-top: 20px;">
            <label class="layui-form-label">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
            <%--密码栏--%>
            <div class="layui-input-block">
                <input type="password" name="upassword" required lay-verify="required" placeholder="请输入密码"
                       autocomplete="off" class="layui-input">
            </div>

        </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="login">登录</button>
<%--                    此处注释原因：注册在form表单内，因此此按钮被默认为包含在处理登录的逻辑中，所以需要另外提出去--%>
<%--                    <button class="layui-btn" onclick="">注册</button>--%>
                </div>
            </div>
            <div class="layui-form-item" pane="">
                <div class="layui-input-block">
                    <input type="checkbox" name="check" value="check" title="十日内免登录">
                </div>
            </div>

    </form>
    <a href="gotoresone">去注册--></a><br>
    <a href="gotoAdminLoginPage">管理员登录</a>


</div>

</body>
<script type="javascript">
    //如果登录用户名或密码错误，调用该方法fail()
    function fail() {
        layui.use("layer",function(){
            var layer = layui.layer;
            layer.msg("用户名或密码错误");
        });
    }
    var demo = document.getElementById("demo");
    demo.onclick = fail();
</script>

</html>
